#include "Main\Application.h"   // standard application include
#include "Main\About.h"         // about box routines
#include "Utility\Resource.h"   // resource utility routines

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////// ABOUT BOX ROUTINES //////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/*/
/ / PARAMETERS:
/ /     hWnd = handle to the window the message belongs to
/ /     uMsg = message to process
/ /     wParam = word sized parameter who's value depends on the message
/ /     lParam = long sized parameter who's value depends on the message
/ /
/ / PURPOSE:
/ /     Window procedure to handle messages for the about box.
/*/

INT_PTR CALLBACK
AboutProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	UNREFERENCED_PARAMETER(lParam);
    INT_PTR nReturn = false;

	switch(uMsg)
	{
	    case WM_INITDIALOG:
        {
            cstring gpl = LoadTextFile(IDT_GPL_TEXTFILE);

            HFONT hBoldFont = CreateFont(24, 0, 0, 0, FW_BOLD, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
                CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, _T("Arial"));

            HFONT hItalicFont = CreateFont(18, 0, 0, 0, FW_NORMAL, true, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
                CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "MS Sans Serif");

            HFONT hGPLFont = CreateFont(12, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
                CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, _T("MS Sans Serif"));

            HICON hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_APPLICATION));

            SendDlgItemMessage(hDlg, IDC_STATIC_OATMEAL, WM_SETFONT, (WPARAM)hBoldFont, (LPARAM)true);
            SendDlgItemMessage(hDlg, IDC_STATIC_NAME, WM_SETFONT, (WPARAM)hItalicFont, (LPARAM)true);
            SendDlgItemMessage(hDlg, IDC_EDIT_GPL, WM_SETFONT, (WPARAM)hGPLFont, (LPARAM)true);
            SendDlgItemMessage(hDlg, IDC_STATIC_LOGO, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hIcon);

            if(gpl != NULL)
            {
                SetDlgItemText(hDlg, IDC_EDIT_GPL, gpl);
                free(gpl);
            }

		    nReturn = true;
            break;
        }

	    case WM_COMMAND:
        {
		    if((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
		    {
			    EndDialog(hDlg, LOWORD(wParam));
			    nReturn = true;
		    }

		    break;
        }
	}

	return nReturn;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////